(function($){
$(document).ready(function() {

    var $page_template = $('#page_template'),
		$post_type = $('#_portfolio_posttype_select'),
		$metabox = $('#portfolio_page_metabox'),
		$videometabox = $('#portfolio_post_video_metabox');
		
	
	$metabox.hide();
	$videometabox.hide();
	
	$post_type.change(function() {
        if ($(this).val() == 'video') {
            $videometabox.show();
        } else {
            $videometabox.hide();
        }
    }).change();
	
    $page_template.change(function() {
        if ($(this).val() == 'page-portfolio.php') {
            $metabox.show();
        } else {
            $metabox.hide();
        }
    }).change();

});
})(jQuery);
